import type { ConditionList, Page, PageResult } from "qqlx-core";

/** pageSize 最多返回 1000 条结果 */
export function getPageDto(pageSize = 15): Page {
  if (pageSize > 1000) pageSize = 1000;

  return {
    page: 1,
    pageSize,
  };
}

export function getPageResultDto<T>(): PageResult<T> {
  return {
    total: 0,
    list: [],
  };
}

export function filterDangerCondition<T>(keys: (keyof T)[], conditionList: ConditionList<T>): ConditionList<T> {
  return conditionList.filter((con) => (keys.includes(con.key) ? false : true));
}
